package com.joejag.mavenstats.client.views.main.home;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class HomePage extends Composite
{
  private HTML body = new HTML();
  private VerticalPanel panel;

  private ScrollPanel scroller = new ScrollPanel(body);

  public HomePage()
  {
    panel = new VerticalPanel();
    panel.add(scroller);
    panel.setSize("100%", "100%");
    panel.setCellHeight(scroller, "100%");
    scroller.setSize("100%", "100%");

    initWidget(panel);

    setStyleName("mail-Detail");

    body.setHTML("<h3>Maven Stats</h3><p>This will make your life 10% better, as proven in tests.</p>");
  }

  public void adjustSize(int windowWidth, int windowHeight)
  {
    int scrollWidth = windowWidth - scroller.getAbsoluteLeft() - 9;
    if (scrollWidth < 1)
      scrollWidth = 1;

    int scrollHeight = windowHeight - scroller.getAbsoluteTop() - 9;
    if (scrollHeight < 1)
      scrollHeight = 1;

    scroller.setSize("" + scrollWidth, "" + scrollHeight);
  }

}
